<!--

    Copyright © 2016-2025 The Thingsboard Authors

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<ng-container *ngIf="mobileAppQrCodeWidgetConfigForm" [formGroup]="mobileAppQrCodeWidgetConfigForm">
  <div class="tb-form-panel no-border no-padding">
    <div class="tb-form-row no-border no-padding-bottom">
      <mat-slide-toggle class="mat-slide" formControlName="useSystemSettings" (click)="$event.stopPropagation()">
        {{ 'admin.mobile-app.use-system-settings' | translate }}
      </mat-slide-toggle>
    </div>
  </div>
  <div class="tb-form-panel no-border no-padding" *ngIf="!mobileAppQrCodeWidgetConfigForm.get('useSystemSettings').value">
    <div class="tb-form-panel">
      <div class="tb-form-panel-title" translate>widget-config.appearance</div>
      <div class="tb-form-hint tb-primary-fill">{{ 'widgets.mobile-app-qr-code.configuration-hint' | translate }}</div>
      <div class="tb-form-row space-between no-padding-bottom column-xs">
        <mat-slide-toggle class="mat-slide fixed-title-width" formControlName="badgeEnabled"
                          (click)="$event.stopPropagation()">
          {{ 'admin.mobile-app.badges' | translate }}
        </mat-slide-toggle>
        <mat-form-field class="flex" appearance="outline" subscriptSizing="dynamic">
          <mat-select formControlName="badgePosition" appearance="outline" subscriptSizing="dynamic">
            <mat-option *ngFor="let badgePosition of badgePositionTranslationsMap | keyvalue" [value]="badgePosition.key">
              {{ badgePosition.value | translate }}
            </mat-option>
          </mat-select>
        </mat-form-field>
      </div>
      <div class="tb-form-row space-between no-padding-bottom column-xs">
        <mat-slide-toggle class="mat-slide fixed-title-width" formControlName="qrCodeLabelEnabled" (click)="$event.stopPropagation()">
          {{ 'admin.mobile-app.label' | translate }}
        </mat-slide-toggle>
        <mat-form-field class="flex" appearance="outline" subscriptSizing="dynamic">
          <input matInput formControlName="qrCodeLabel" placeholder="{{'admin.mobile-app.set' | translate}}">
        </mat-form-field>
      </div>
      <div class="tb-form-row column-xs">
        <mat-slide-toggle class="mat-slide fixed-title-width" formControlName="showTitle">
          {{ 'widgets.liquid-level-card.title' | translate }}
        </mat-slide-toggle>
        <div class="tb-flex row flex-start align-center">
          <mat-form-field class="flex" appearance="outline" subscriptSizing="dynamic">
            <input matInput formControlName="title" placeholder="{{ 'widget-config.set' | translate }}">
          </mat-form-field>
          <tb-font-settings formControlName="titleFont"
                            [previewText]="mobileAppQrCodeWidgetConfigForm.get('title').value">
          </tb-font-settings>
          <tb-color-input asBoxInput colorClearButton formControlName="titleColor">
          </tb-color-input>
        </div>
      </div>
      <div class="tb-form-row column-xs">
        <mat-slide-toggle class="mat-slide fixed-title-width" formControlName="showTitleIcon">
          {{ 'widgets.liquid-level-card.icon' | translate }}
        </mat-slide-toggle>
        <div class="tb-flex row flex-end align-center">
          <mat-form-field appearance="outline" class="number flex" subscriptSizing="dynamic">
            <input matInput type="number" min="0" formControlName="iconSize" placeholder="{{ 'widget-config.set' | translate }}">
          </mat-form-field>
          <tb-css-unit-select class="flex-1" formControlName="iconSizeUnit"></tb-css-unit-select>
          <tb-material-icon-select asBoxInput
                                   iconClearButton
                                   [color]="mobileAppQrCodeWidgetConfigForm.get('iconColor').value"
                                   formControlName="titleIcon">
          </tb-material-icon-select>
          <tb-color-input asBoxInput colorClearButton formControlName="iconColor">
          </tb-color-input>
        </div>
      </div>
    </div>
    <div class="tb-form-panel">
      <div class="tb-form-panel-title" translate>widget-config.card-appearance</div>
      <div class="tb-form-row space-between">
        <div>{{ 'widgets.background.background' | translate }}</div>
        <tb-background-settings formControlName="background">
        </tb-background-settings>
      </div>
      <div class="tb-form-row space-between">
        <div translate>widget-config.show-card-buttons</div>
        <mat-chip-listbox multiple formControlName="cardButtons">
          <mat-chip-option value="fullscreen">{{ 'fullscreen.fullscreen' | translate }}</mat-chip-option>
        </mat-chip-listbox>
      </div>
      <div class="tb-form-row space-between">
        <div>{{ 'widget-config.card-border-radius' | translate }}</div>
        <mat-form-field appearance="outline" subscriptSizing="dynamic">
          <input matInput formControlName="borderRadius" placeholder="{{ 'widget-config.set' | translate }}">
        </mat-form-field>
      </div>
      <div class="tb-form-row space-between">
        <div>{{ 'widget-config.card-padding' | translate }}</div>
        <mat-form-field appearance="outline" subscriptSizing="dynamic">
          <input matInput formControlName="padding" placeholder="{{ 'widget-config.set' | translate }}">
        </mat-form-field>
      </div>
    </div>
    <tb-widget-actions-panel
      formControlName="actions">
    </tb-widget-actions-panel>
  </div>
</ng-container>
